package com.chenwc.rocketmq.prop;

import java.io.InputStream;
import java.util.Properties;

/**
 * rocketmq连接属性
 *
 * @author wc.chen
 */
public class RocketMqConnectionProperties {
    private String namesrvAddr;
    private String brokerAddr;
    private String accessKey;
    private String secretKey;
    public RocketMqConnectionProperties() {
        InputStream is = null;
        Properties properties = new Properties();
        try {
            is = RocketMqConnectionProperties.class.getClassLoader().getResourceAsStream("connect.properties");
            properties.load(is);
        } catch (Exception e) {
            throw new RuntimeException("加载配置文件失败");
        } finally {
            try {
                if (null != is) {
                    is.close();
                }
            } catch (Exception ignored) {

            }
        }
        this.namesrvAddr = properties.getProperty("rocketmq.nameserver.address");
        this.brokerAddr = properties.getProperty("rocketmq.broker.address");
        this.accessKey = properties.getProperty("rocketmq.accessKey");
        this.secretKey = properties.getProperty("rocketmq.secretKey");
    }

    public String getNamesrvAddr() {
        return namesrvAddr;
    }

    public void setNamesrvAddr(String namesrvAddr) {
        this.namesrvAddr = namesrvAddr;
    }

    public String getBrokerAddr() {
        return brokerAddr;
    }

    public void setBrokerAddr(String brokerAddr) {
        this.brokerAddr = brokerAddr;
    }

    public String getAccessKey() {
        return accessKey;
    }

    public void setAccessKey(String accessKey) {
        this.accessKey = accessKey;
    }

    public String getSecretKey() {
        return secretKey;
    }

    public void setSecretKey(String secretKey) {
        this.secretKey = secretKey;
    }
}
